package com.pzhu.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

public class TestServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        req.setAttribute("str", "request对象中添加了数据");
        HttpSession session = req.getSession();
        session.setAttribute("str1", "session对象中添加的数据");
        System.out.println("TestServlet.service");
        resp.getWriter().write("我是ts");
    }
}
